# Maintainer: J. Peter Mugaas <jpmugaas@suddenlink.net>

pkgname=publicsuffix-list
pkgver=20201218.1042.2953934
pkgrel=1
pkgdesc='Cross-vendor public domain suffix database'
url='https://github.com/publicsuffix/list'
arch=('any')
license=('custom:MPL2')
makedepends=('git')
checkdepends=('libxslt-devel' 'python3' 'icu>=59.1')
_commit="29539349ed689ecbdda995273d19b5ec64b09521"
source=(${pkgname}::"git+https://github.com/publicsuffix/list#commit=${_commit}")
sha512sums=('SKIP')

pkgver() {
  cd ${pkgname}
  printf "%s.%s.%s" "$(TZ=UTC git show -s --pretty=%cd --date=format-local:%Y%m%d "${_commit}")" \
    "$(git rev-list --count "${_commit}")" \
    "$(git rev-parse --short "${_commit}")"
}

check() {
  cd ${pkgname}
  make test
}

package() {
  cd ${pkgname}
  install -Dm 644 public_suffix_list.dat tests/test_psl.txt -t "${pkgdir}/usr/share/publicsuffix"
  ln -s public_suffix_list.dat "${pkgdir}/usr/share/publicsuffix/effective_tld_names.dat"
  install -Dm 644 LICENSE -t "${pkgdir}/usr/share/licenses/${pkgname}"
}
